package com.alibaba.citrus.cr.unified.inventory.model.enums;

import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * @author wanwy
 * @description 拒绝原因
 */
public enum ReasonForRejectionEnum {
    INSUFFICIENT_SHIPPING_STANDARD("01","不够发运标准"),
    NOT_ENOUGH_TO_GENERATE_ORDER("02","不足起订单"),
    LARGE_AREA_REQUIREMENT_STOP_ISSUING("03","大区要求停发"),
    UNPLANNED_DEMAND("04","计划外需求"),
    CUSTOMER_REQUIREMENT_TO_VOID_WRONG_ORDER("05","客户要求作废，录错订单"),
    CUSTOMER_REQUIREMENT_TO_VOID_DATED("06","客户要求作废，日期陈旧"),
    CUSTOMER_REQUIREMENT_TO_VOID_SELECT_ORIGIN("07","客户要求作废，挑产地"),
    CUSTOMER_REQUIREMENT_TO_VOID_REPEAT_FORECAST_ORDER("08","客户要求作废，重复预报订单"),
//15	打折后计划外需求
//16	回复量小无法配车
//17	实际到货地址与系统到货地址不符
//18	非客户需求产品
//19	按库房托盘数订单
//20	关闭订单
    NO_GOODS_WAITING_FOR_PRODUCTION("09","无货，等待生产"),
    NO_GOODS_NOT_REACHED_ON_THE_WAY("10","无货，在途未达"),
    CASH_POOR("11","无款，款不足"),
    CASH_POOR_ARREARS("12","无款，款不足"),
    NO_GOODS_WAIT_UNTIL_THE_INSULATION_TEST_IS_COMPLETED("13","无货,保温试验等待放行"),
    NO_GOODS_OBSOLETE_PRODUCT("14","无货,淘汰产品"),
//21	改单，零包整改
//22	改单，调度无货下单
//23	改单，物流装车剩余
//24	改单，变换品项
//25	改单，调度通知减量
//26	改单，调度未按装箱标准下单
//27	学生奶口味/包装互调
//28	货损
//29	部分品项差量控制紧俏品
//30	因不卸车缓发原因停货
//31	因窜货，要求停发
//32	超旬回复量
//33	小品项等待生产
//34	BP无货等生产
//35	BP无货在途
//36	BP产品待检
//37	BP不足底线车型
//38	BP大区要求停发
//39	BP无计划或超计划需求
//40	BP无款、货款不足
//41	BP实际到货地址与系统到货地址不符
//42	BP客户录错、重复预报
//43	BP关闭未清销售订单
//44	BP产品已下市淘汰
//45	BP客户要求等通知调单
//46	BP产品生产日期不符合客户需求
//    Y0	YSL供应链-产品大日期
//    Y1	YSL供应链-月中晚供
//    Y2	YSL销售-超过截单日
//    Y3	YSL销售-订单错误，客户要求重录
//    Y4	YSL销售-政策原因，改单
//    Y5	YSL销售-不够发运标准
//    Y6	YSL销售-差款、等银行贷款
//    Y7	YSL供应链-超计划量作废
//    Y8	YSL销售-客户冻结
//    Y9	YSL销售-产品下市
//    Z1	销售公司：关闭行项目
//    Z2	销售公司：缺货
    DANONE_LOW_TEMPERATURE("Z2","达能低温");

    private String code;

    private String desc;

    ReasonForRejectionEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    /**
     * 通过code获取枚举
     *
     * @param code code
     * @return by code
     */
    public static ReasonForRejectionEnum getByCode(String code) {
        if (StringUtils.isBlank(code)) {
            return null;
        }
        for (ReasonForRejectionEnum reasonForRejectionEnum : values()) {
            if (StringUtils.equalsIgnoreCase(code, reasonForRejectionEnum.getCode())) {
                return reasonForRejectionEnum;
            }
        }
        return null;
    }

    /**
     * 获取所有的单据原因枚举
     * @return
     */
    public static List<ReasonForRejectionEnum> queryEnum(){
        List<ReasonForRejectionEnum> list = new ArrayList<>();
        for (ReasonForRejectionEnum reasonForRejectionEnum : values()) {
            list.add(reasonForRejectionEnum);
        }
        return list;
    }
}
